
// 创建axios实例
import axios from "axios";

const api = axios.create({
    // baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
    // baseURL: "http://10.0.0.3:8080", // url = base url + request url
    baseURL: "http://localhost:8087",
    // baseURL: "https://www.itzixi.com/api", // url = base url + request url
    withCredentials: true, // send cookies when cross-domain requests
    timeout: 5000 // request timeout
});

// axios请求的拦截器
api.interceptors.request.use(

);

// axios响应的拦截器
api.interceptors.response.use(
    response => {
        const res = response.data
        return res;
    },
    error => {
        console.log('err: ' + error) // for debug
        console.log('err: ' + error.data) // for debug
        return Promise.reject(error)
    }
)
export default api;